Fix the build of the native gtk-update-icon-cache when cross-compiling.
authorJehan <jehan@girinstud.io>
Wed, 13 Aug 2014 07:11:23 +0000 (07:11 +0000)
committerJehan <jehan@girinstud.io>
Wed, 13 Aug 2014 21:06:51 +0000 (21:06 +0000)
As a noinst_PROGRAMS, the libtool generated for cross-compiling will be
used, which will mess up the linking. Create a all-local target instead.
Also ensure that building uses always a native version of the tool by
specifying a GTK_UPDATE_ICON_CACHE automake variable.
Finally "config.h" has been created to work for the target platform and
causes problem when cross-compiling. So we temporarily generate a basic
config.h which contains only the strict minimum.

configure.ac
demos/gtk-demo/Makefile.am
demos/widget-factory/Makefile.am
gtk/Makefile.am
gtk/native/Makefile.am

index 6221f60f7cd8989a99e44ddf4c8b773c37234ac5..112c4133f75fb7cd162fc1e4a525a2410efeefdb 100644 (file)
@@ -936,7 +936,9 @@ AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
 AS_IF([test "x$enable_gtk2_dependency" = xyes],
       [AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
        if test x$GTK_UPDATE_ICON_CACHE = xno; then
-         REBUILD_PNGS=#
+         AC_MSG_ERROR([
+*** --enable-gtk2-dependency has been set but no existing
+*** `gtk-update-icon-cache` has been found in the path.])
        fi],
 
       [test "x$cross_compiling" = xyes],
@@ -954,22 +956,23 @@ AS_IF([test "x$enable_gtk2_dependency" = xyes],
 
        NATIVE_GDKPIXBUF_CFLAGS=`$PKG_CONFIG_FOR_BUILD --cflags gdk-pixbuf-2.0`
        NATIVE_GDKPIXBUF_LIBS=`$PKG_CONFIG_FOR_BUILD --libs gdk-pixbuf-2.0`
+       # This is the native gtk-update-icon-cache which will be used at
+       # build time, NOT the one installed on the target host.
+       GTK_UPDATE_ICON_CACHE="`cd $srcdir && pwd`/gtk/native/native-update-icon-cache$BUILD_EXEEXT"
        AC_SUBST(NATIVE_GDKPIXBUF_CFLAGS)
-       AC_SUBST(NATIVE_GDKPIXBUF_LIBS)]
+       AC_SUBST(NATIVE_GDKPIXBUF_LIBS)
+       AC_SUBST(GTK_UPDATE_ICON_CACHE)],
+
+      [# In native compiling case, the gtk-update-icon-cache installed
+       # is the same as the one used during build.
+       GTK_UPDATE_ICON_CACHE="`cd $srcdir && pwd`/gtk/gtk/gtk-update-icon-cache$EXEEXT"
+       AC_SUBST(GTK_UPDATE_ICON_CACHE)]
 )
 
 AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$enable_gtk2_dependency" = xyes])
 
 AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
 
-if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
-   test "x$REBUILD_PNGS" = "x#" ; then
-     AC_MSG_ERROR([
-*** gtkbuiltincache.h is not in the tree, and cannot be built
-*** because you don't have libpng, or (when cross-compiling) you
-*** don't have a prebuilt gtk-update-icon-cache on the build system.])
-fi
-
 ########################################
 # Windowing system checks
 ########################################
index 4eb391416103cd7986d58db432fcf7430a4f6550..0ef288f78cf244694d769968dfc632f0e2287a69 100644 (file)
@@ -165,7 +165,7 @@ dist_appsicon32_DATA = data/32x32/gtk3-demo.png
 dist_appsicon48_DATA = data/48x48/gtk3-demo.png
 dist_appsicon256_DATA = data/256x256/gtk3-demo.png
 
-update_icon_cache = gtk-update-icon-cache --ignore-theme-index --force
+update_icon_cache = $(GTK_UPDATE_ICON_CACHE) --ignore-theme-index --force
 
 install-data-hook: install-update-icon-cache
 uninstall-hook: uninstall-update-icon-cache
index ff72599c6d6ca9b06177c458eac6df031bbed873..d04b9c7e64630e13ef0102128868ecd9897061eb 100644 (file)
@@ -45,7 +45,7 @@ dist_appsicon32_DATA = data/32x32/gtk3-widget-factory.png
 dist_appsicon48_DATA = data/48x48/gtk3-widget-factory.png
 dist_appsicon256_DATA = data/256x256/gtk3-widget-factory.png
 
-update_icon_cache = gtk-update-icon-cache --ignore-theme-index --force
+update_icon_cache = $(GTK_UPDATE_ICON_CACHE) --ignore-theme-index --force
 
 install-data-hook: install-update-icon-cache
 uninstall-hook: uninstall-update-icon-cache
index 7b78fb87d4e8d4cfeab59192961a7fa5ee069a37..12877ef21dcae622c1edf71c699053b2028a01d5 100644 (file)
@@ -1704,16 +1704,6 @@ files:
          echo $$p; \
        done
 
-if USE_EXTERNAL_ICON_CACHE
-gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
-else
-if CROSS_COMPILING
-gtk_update_icon_cache_program = ./native/native-update-icon-cache
-else
-gtk_update_icon_cache_program = ./gtk-update-icon-cache$(EXEEXT)
-endif
-endif
-
 gsettings_SCHEMAS = \
        org.gtk.Settings.FileChooser.gschema.xml \
        org.gtk.Settings.ColorChooser.gschema.xml \
index 64899e96c1420963c3e2716e0694a89df9f00cfa..7516dabfc347704e38be41053023e2a8fdb5f7be 100644 (file)
@@ -4,9 +4,15 @@ CPP = @CPP_FOR_BUILD@
 AM_CPPFLAGS = @CPPFLAGS_FOR_BUILD@
 AM_LDFLAGS = @LDFLAGS_FOR_BUILD@
 
+native-update-icon-cache$(BUILD_EXEEXT): $(srcdir)/../updateiconcache.c
+       echo '#define GETTEXT_PACKAGE "gtk30"' > $(srcdir)/config.h
+       $(AM_V_CCLD)$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -I. -I$(srcdir)/../.. $(NATIVE_GDKPIXBUF_CFLAGS) $(CFLAGS_FOR_BUILD) $^ $(LDFLAGS_FOR_BUILD) $(NATIVE_GDKPIXBUF_LIBS) $(LIBS_FOR_BUILD) -o $@
+       rm -f $(srcdir)/config.h
+
 if CROSS_COMPILING
 if !USE_EXTERNAL_ICON_CACHE
-noinst_PROGRAMS = native-update-icon-cache
+all-local: native-update-icon-cache$(BUILD_EXEEXT)
+
 native_update_icon_cache_CFLAGS = $(NATIVE_GDKPIXBUF_CFLAGS)
 native_update_icon_cache_LDADD = $(NATIVE_GDKPIXBUF_LIBS)
 native_update_icon_cache_SOURCES = $(srcdir)/../updateiconcache.c